A virtual machine system can include multiple host computers and each host computer can support multiple virtual machines. Each virtual machine runs a guest operating system and guest applications (collectively referred to as a “guest”) for a client. From time to time a system administrator may want to move (“migrate”) a guest from one host computer (“source host”) to another host computer (“target host”) for maintenance or performance reasons. The migration may be an “online migration” (also referred to as “live migration”), which means that the guest can be moved without disconnecting its clients or applications.
During an online migration, the guest keeps running on the source host while it is being migrated to the target host. Most of the data used by the guest is transferred to the target host, while the guest continues to run normally on the source host. There is a brief period when the guest is paused on the source host, during which all of the critical data of the guest is transferred to the target host. After the data transfer, the guest resumes running on the target host.
By contrast, an offline migration means stopping the guest on the source host, recording its state, and then resuming the guest later on the target host. There is a significant time gap between the end of the operation of the guest at the source host and the beginning of the operation of the guest at the target, which is visible to the clients of the guest as well as the guest itself. This can potentially disrupt the function of the applications of the guest and disconnect the clients of the guest in some scenarios.
Due to the complexity of the migration code, it is very easy for bugs to creep in during development of the migration code. For example, a guest can have access to a number of devices, and the states of the devices can change during operation. Device states supported by the source host may not be available on the target host. As a result, migrating the guest can lead to guest crashes and/or unexpected behavior after either an online or offline migration.
Conventionally, test engineers routinely develop tests that start a guest and migrate it in various states: e.g., during installation of the guest, after installation of the guest, and while the guest is performing network I/O. These scenarios test various workloads and various code paths in the migration code. It is time-consuming for the test engineers to develop test code that covers all of these scenarios.